package com.zyh.demo.domain;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @Author zyh
 * @Date 2024/8/14 11:08
 * @Description
 */

public class Book implements Serializable {
    @Serial
    private static final long serialVersionUID = -3217379968339467930L;
    private String bName;
    private String author;
    private Double price;
    private Date createTime;

    public Book() {
    }

    public Book(String bName, String author, Double price, Date createTime) {
        this.bName = bName;
        this.author = author;
        this.price = price;
        this.createTime = createTime;
    }

    public String getbName() {
        return bName;
    }

    public void setbName(String bName) {
        this.bName = bName;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return "Book{" +
                "bName='" + bName + '\'' +
                ", author='" + author + '\'' +
                ", price=" + price +
                ", createTime=" + createTime +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Book book = (Book) o;

        if (bName != null ? !bName.equals(book.bName) : book.bName != null) return false;
        if (author != null ? !author.equals(book.author) : book.author != null) return false;
        if (price != null ? !price.equals(book.price) : book.price != null) return false;
        return createTime != null ? createTime.equals(book.createTime) : book.createTime == null;
    }

    @Override
    public int hashCode() {
        int result = bName != null ? bName.hashCode() : 0;
        result = 31 * result + (author != null ? author.hashCode() : 0);
        result = 31 * result + (price != null ? price.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        return result;
    }
}
